<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>3WCoffee咖啡馆签到</title>
        <script>
            var welcomeUrl = "${baseUrl}";
            
            function checkLocation(){
                if (!navigator.geolocation) {
                    alert("抱歉您的手机或者您使用的浏览器不支持定位功能，不能签到。请使用具有GPS定位功能的iPhone、iPad或者Android手机，并确认是用手机自带的标准浏览器访问本页面进行签到。");
                    self.location = welcomeUrl;
                }
                else {
                    // onSuccess Callback
                    //   This method accepts a `Position` object, which contains
                    //   the current GPS coordinates
                    var onSuccess = function(position){
                        alert('Latitude: ' + position.coords.latitude + '\n' +
                        'Longitude: ' +
                        position.coords.longitude +
                        '\n' +
                        'Altitude: ' +
                        position.coords.altitude +
                        '\n' +
                        'Accuracy: ' +
                        position.coords.accuracy +
                        '\n');
                        
                        var lat = position.coords.latitude;
                        var lng = position.coords.longitude;
						var acy = position.coords.accuracy;
						var targetUrl = welcomeUrl + '/vfl.sf?lat=' + lat + '&lng=' + lng + "&acy=" + acy;
						self.location = targetUrl;
                    };
                    
                    // onError Callback receives a PositionError object
                    function onError(error){
                        alert('获取GPS位置信息失败。');
                        self.location = welcomeUrl;
                    }
                    
                    navigator.geolocation.getCurrentPosition(onSuccess, onError);
                }
            }
            
        </script>
    </head>
    <body onload="checkLocation()">
    	<div class="logo">
            <img src="images/sp/logo.jpg" alt="logo" width="320" height="75" />
        </div>
        <div>
            <span id="content" class="show_info"><img class="pic-loading" src="images/loading.gif" alt="Get Browser Geolocation"/>正在获得您的位置信息...</span>
        </div>
    </body>
</html>